package com.jimmy.medical.repository;

import com.jimmy.medical.entity.Hospital;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface HospitalRepository extends JpaSpecificationExecutor<Hospital>, PagingAndSortingRepository<Hospital, Long> {

    @Query("select o from Hospital o left join o.city c where c.id=?1")
    List<Hospital> findByCityId(Long cityId);
}
